package com.example.administrator.netdemo;

import android.content.Context;


import com.example.administrator.netdemo.network.CommonNextCallBack;
import com.example.administrator.netdemo.network.SimpleSubscriber;
import com.example.administrator.netdemo.network.base.BaseModel;
import com.example.administrator.netdemo.network.base.HttpResult;

import java.util.HashMap;
import java.util.Map;

/**
 * 2019/7/19 16:34
 * ChenYuanWang
 */
public class TestModel extends BaseModel {

    public TestModel(Context context) {
        super(context);
    }

    public void testOk(final VMTest.test test) {
        toSubscribe(apiService.testOk().filter(
                new NoFilterFunc<HttpResult<Object>>(test)).flatMap(new MyFlatMapRespFuc<HttpResult<Object>>()),
                new SimpleSubscriber<>(new CommonNextCallBack<HttpResult<Object>>() {
                    @Override
                    public void onNext(int state, HttpResult<Object> result) {

                    }
                }, context).setShowTips(true));
    }

    public void test404(final VMTest.test test) {
        toSubscribe(apiService.test404().filter(
                new NoFilterFunc<HttpResult<Object>>(test)).flatMap(new MyFlatMapRespFuc<HttpResult<Object>>()),
                new SimpleSubscriber<>(new CommonNextCallBack<HttpResult<Object>>() {
                    @Override
                    public void onNext(int state, HttpResult<Object> result) {

                    }
                }, context).setShowTips(true));
    }


}
